package com.pokeoffice.users;

/**
 * The Enum UserType.
 */
public enum UserType {
	
	/** The NONE. */
	NONE, /** The TRAINER. */
 TRAINER, /** The NURSE. */
 NURSE, /** The PROFESSOR. */
 PROFESSOR, /** The ADMIN. */
 ADMIN;
	
	/**
	 * Grants.
	 *
	 * @return the string
	 */
	public String grants() {
		String grants;
		switch(this) {
		case NONE:
			grants = "USAGE";
			break;
		case TRAINER:
			grants = "ALL";
			break;
		case NURSE:
			grants = "ALL";
			break;
		case PROFESSOR:
			grants = "ALL";
			break;
		case ADMIN:
			grants = "ALL";	// WITH GRANT OPTION, handled in Control.create
			break;
		default:
			grants = "USAGE";
			break;
		}
		return grants;
	}

	/* (non-Javadoc)
	 * @see java.lang.Enum#toString()
	 */
	public String toString() {
		String s = "none";
		switch (this) {
		case NONE:
			s = "none";
			break;
		case TRAINER:
			s = "trainer";
			break;
		case NURSE:
			s = "nurse";
			break;
		case PROFESSOR:
			s = "professor";
			break;
		case ADMIN:
			s = "admin";
			break;
		default:
			s = "none";
			break;
		}
		return s;
	}
}
